package com.course.server.enums;

import lombok.Getter;

import java.util.Objects;

/**
 * @author: Durian
 * @date: 2021/5/9 13:42
 */
@Getter
public enum FileUseEnum {

    COURSE("C", "课程"),
    TEACHER("T", "讲师"),
    UNKNOWN("U", "未知")
    ;

    private final String code;
    private final String desc;

    FileUseEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static FileUseEnum get(String code) {
        for (FileUseEnum value : FileUseEnum.values()) {
            if (Objects.equals(code, value.getCode())) {
                return value;
            }
        }
        return UNKNOWN;
    }
}
